const babel = require("@babel/core");

const sourceCode = `
<div>
  hello<span stye={{color: "red"}}>world</span>
</div>
`;

const result = babel.transform(sourceCode, {
  plugins: [["@babel/plugin-transform-react-jsx", { runtime: "automatic" }]],
});

console.log(result.code);

/**
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
_jsxs("div", {
  children: ["hello", _jsx("span", {
    stye: {
      color: "red"
    },
    children: "world"
  })]
});
 */
